//
//  PKGroupIntroduceViewController.m
//  PiankeProject
//
//  Created by lanou on 15/10/14.
//  Copyright (c) 2015年 xiaolizi. All rights reserved.
//

#import "PKGroupIntroduceViewController.h"
#import "PKRequestManager.h"
#import "PKGroupIntroduceModel.h"
#import <UIImageView+WebCache.h>
#import "PKGroupIntroduceView.h"
@interface PKGroupIntroduceViewController ()
@property(nonatomic,strong) PKGroupIntroduceModel *introModel;
@property(nonatomic,strong) PKGroupIntroduceView *introView;
@end

@implementation PKGroupIntroduceViewController

- (PKGroupIntroduceModel *)introModel
{
    if (!_introModel)
    {
        self.introModel = [[PKGroupIntroduceModel alloc] init];
    }
    return _introModel;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self requestData];
    _introView = [[PKGroupIntroduceView alloc] initWithFrame:CGRectMake(0, 65, SCREEN_WIDTH, SCREEN_HEIGHT - 65)];
    [self.view addSubview:_introView];
}

// 请求数据
- (void)requestData
{
    
    NSMutableDictionary *parDic = [NSMutableDictionary dictionary];
    parDic[@"deviceid"] = @"7A1A4DD9-FE7F-4585-8202-1BCA31DA85BF";
    parDic[@"groupid"] = self.listModel.groupid;
    parDic[@"auth"] = @"CMxvEHri9qtDC8Z9H8TrkjJxQMKjPbbbm32km3Xzdm1cWP22NdNQxpZ7Pw&client";
    parDic[@"version"] = @"3.0.6";
    [PKRequestManager requestWithType:POST url:@"http://api2.pianke.me/group/group_detail" parDic:parDic finish:^(NSData *data) {
        NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers | NSJSONReadingMutableLeaves error:nil];
        NSDictionary *dict = dic[@"data"][@"groupinfo"];
        [self.introModel setValuesForKeysWithDictionary:dict];
        _introView.introModel = self.introModel;
        } error:nil];

}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
